﻿using Admin.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Admin.Controllers
{
    public class LanguageSelectionController : BaseController
    {
        //
        // GET: /LanguageSelection/

        public string lang
        {
            get { return Request.QueryString["lang"].ToString(); }
        }

        public ActionResult Index()
        {
            switch (lang)
            {
                case "vn":
                    SessionManager.CurrentCulture = 0;
                    Session["CurrentCulture"] = 0;
                    break;
                case "en":
                    SessionManager.CurrentCulture = 1;
                    Session["CurrentCulture"] = 1;
                    break;
                default:
                    SessionManager.CurrentCulture = 0;
                    Session["CurrentCulture"] = 0;
                    break;
            }
            return Redirect(Request.UrlReferrer.ToString());
        }

        public ActionResult ChangeCurrentCulture()
        {
            switch (lang)
            {
                case "vn":
                    SessionManager.CurrentCulture = 0;
                    Session["CurrentCulture"] = 0;
                    break;
                case "en":
                    SessionManager.CurrentCulture = 1;
                    Session["CurrentCulture"] = 1;
                    break;
                default:
                    SessionManager.CurrentCulture = 0;
                    Session["CurrentCulture"] = 0;
                    break;
            }
            return PartialView("ChangeCurrentCulture");

        }
    }
}
